package test1;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Test1 {
    public static void main(String[] args) throws InterruptedException {
        List<String> gift = new ArrayList<>();
        String[] gifts = {"apple", "banana", "orange","皮带","车钥匙","手机"};
        Random rand = new Random();
        for (int i = 0; i < 100; i++) {
            gift.add(gifts[rand.nextInt(gifts.length)]+(i+1));
        }
        System.out.println(gift);

        //定义线程类，创建对象
        SentThread xm = new SentThread(gift,"小红");
        xm.start();
        SentThread xh = new SentThread(gift,"小明");
        xh.start();

        xm.join();
        xh.join();
        System.out.println(xm.getCount());
        System.out.println(xh.getCount());


    }
}
